﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ListenMusic.Models.ViewModel;
using ListenMusic.Song_ServiceReference;
using ListenMusic.Album_ServiceReference;
using System.ServiceModel;
namespace ListenMusic.Models.Reposistory.Public
{
    public class SearchReposistory
    {
        SongReposistory _song;
        AlbumReposistory _album;
        VideoReposistory _video;
        SingerReposistory _singer;
        public SearchReposistory()
        {
            _album = new AlbumReposistory();
            _song = new SongReposistory();
            _video = new VideoReposistory();
            _singer = new SingerReposistory();
        }
        public Search_bySinger search_bySingerID(string singerName)
        {
            try {
                Singer_ServiceReference.Singer singer = _singer.getSinger_bySingerName(singerName);
                Search_bySinger sbs = new Search_bySinger();
                if (singer != null)
                {
                    sbs.lst_songSinger = _song.getAllSong_bySingerID(singer.SingerID,1);
                    sbs.lst_albumSinger = _album.getAllAlbumSinger_bySingerID(singer.SingerID);
                    sbs.lst_videoSinger = _video.getAllVideo_bySingerID(singer.SingerID, 2);
                }
                return sbs;
            }
            catch (FaultException e) { throw e; }
        }
    }
    
}